
package org.easydarwin.easyrtc;

import android.app.Application;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;

import com.android.volley.RequestQueue;
import com.android.volley.toolbox.Volley;
import com.squareup.otto.Bus;
import com.squareup.otto.ThreadEnforcer;

import org.easydarwin.android.aio.AudioIO;
import org.easydarwin.data.EasyDBHelper;
import org.easydarwin.network.RequestManager;
import org.easydarwin.util.PreferenceManager;

/**
 * Created by john on 2017/4/8.
 */

public class TheApp extends Application {
    public static AudioIO aio;
    public static Bus bus;
    private static TheApp instance;

    public static SQLiteDatabase sDB;

    public TheApp (){}
    public static TheApp getInstance(){
        if(null == instance){
            instance = new TheApp();
        }
        return instance;
    }
    @Override
    public void onCreate() {
        super.onCreate();
        bus = new Bus(ThreadEnforcer.ANY);
        aio = new AudioIO(this, bus, 8000, false);
        PreferenceManager.init(this);
        RequestManager.init(this);

        sDB = new EasyDBHelper(this).getWritableDatabase();
    }

    public Context getContext(){
        return this.getApplicationContext();
    }
}

